package system;

import java.awt.image.BufferedImage;

/**
 * @author Kevin Peters
 */
public class ImagePart {
	private BufferedImage image;
	private int sourceCoordinateX;
	private int sourceCoordinateY;
	private int sourceIndex;
	private int editorIndex;

	public BufferedImage getImage() {
		return image;
	}

	public void setImage(BufferedImage image) {
		this.image = image;
	}

	public int getSourceCoordinateX() {
		return sourceCoordinateX;
	}

	public void setSourceCoordinateX(int sourceCoordinateX) {
		this.sourceCoordinateX = sourceCoordinateX;
	}

	public int getSourceCoordinateY() {
		return sourceCoordinateY;
	}

	public void setSourceCoordinateY(int sourceCoordinateY) {
		this.sourceCoordinateY = sourceCoordinateY;
	}

	public int getSourceIndex() {
		return sourceIndex;
	}

	public void setSourceIndex(int sourceIndex) {
		this.sourceIndex = sourceIndex;
	}

	public int getEditorIndex() {
		return editorIndex;
	}

	public void setEditorIndex(int editorIndex) {
		this.editorIndex = editorIndex;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + editorIndex;
		result = prime * result + ((image == null) ? 0 : image.hashCode());
		result = prime * result + sourceCoordinateX;
		result = prime * result + sourceCoordinateY;
		result = prime * result + sourceIndex;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ImagePart other = (ImagePart) obj;
		if (editorIndex != other.editorIndex)
			return false;
		if (image == null) {
			if (other.image != null)
				return false;
		} else if (!image.equals(other.image))
			return false;
		if (sourceCoordinateX != other.sourceCoordinateX)
			return false;
		if (sourceCoordinateY != other.sourceCoordinateY)
			return false;
		if (sourceIndex != other.sourceIndex)
			return false;
		return true;
	}

}
